export default{
    data(){
        return { }
    },
    mounted(){
        this.drawLine();
    },
    methods:{
        drawLine(){
            // 基于准备好的dom，初始化echarts实例
            let myChart = this.$echarts.init(document.getElementById('container'))
            // 绘制图表
            myChart.setOption({
                title: {
                    text: '走势图'
                },
                show: true,
                tooltip: {
                    trigger: 'axis'
                },
                legend: {
                    data:['新注册用户','新增管理员','新增订单']
                },
                grid: {
                    left: '3%',
                    right: '4%',
                    bottom: '3%',
                    containLabel: true
                },
                toolbox: {
                    show: true,
                    feature: {
                        dataZoom: {
                            yAxisIndex: 'none'
                        },
                        dataView: {readOnly: false},
                        magicType: {type: ['line', 'bar']},
                        restore: {},
                        saveAsImage: {}
                    }
                },
                xAxis: {
                    type: 'category',
                    boundaryGap: false,
                    data: ['周一','周二','周三','周四','周五','周六','周日']
                },
                yAxis: {
                    type: 'value'
                },
                series: [
                    {
                        name:'新注册用户',
                        type:'line',
                        data:[71, 61, 125, 19, 18, 11, 7],
                        markPoint: {
                            data: [
                                {type: 'max', name: '最大值'},
                                {type: 'min', name: '最小值'}
                            ]
                        }
                    },
                    {
                        name:'新增管理员',
                        type:'line',
                        data:[41, 29, 56, 5, 10, 1, 3],
                        markPoint: {
                            data: [
                                {type: 'max', name: '最大值'},
                                {type: 'min', name: '最小值'}
                            ]
                        }
                    },
                    {
                        name:'新增订单',
                        type:'line',
                        data:[5, 6, 29, 1, 10, 5, 3],
                        markPoint: {
                            data: [
                                {type: 'max', name: '最大值'},
                                {type: 'min', name: '最小值'}
                            ]
                        }
                    }
                ]
            })
        },
        // 跳转至首页
        goToIndex(){ this.$router.push({ path: '/Main/index' }) },
        // 退出登录
        LogOUt(){ this.$router.push({ path: '/' }) }
    }
}